<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>BNF for kpython.jj</TITLE>
</HEAD>
<BODY>
<H1 ALIGN=CENTER>BNF for kpython.jj</H1>
<H2 ALIGN=CENTER>TOKENS</H2>
<TABLE>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;DEFAULT&gt; SKIP : {
" "
| "\t"
| "\f"
| &lt;COMMENT1: "#" (~["\n","\r"])*&gt;
| &lt;CONTINUATION: "\\" ("\r\n" | "\n" | "\r")&gt;
| &lt;NEWLINE: "\r\n" | "\n" | "\r"&gt; : {
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;INDENTING&gt; SKIP : {
&lt;TAB: ("\t")+&gt; : {
| &lt;SPACE: (" ")*&gt; : {
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;INDENTATION_UNCHANGED&gt; SKIP : {
"" : DEFAULT
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;INDENTATION&gt; TOKEN : {
&lt;DEDENT: ""&gt; : DEFAULT
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;UNREACHABLE&gt; TOKEN : {
&lt;INDENT: "&lt;INDENT&gt;"&gt; : DEFAULT
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;DEFAULT&gt; TOKEN : {
&lt;COLON: ":"&gt;
| &lt;COMMA: ","&gt;
| &lt;DOT: "."&gt;
| &lt;SEMICOLON: ";"&gt;
| &lt;LBRACE: "("&gt;
| &lt;RBRACE: ")"&gt;
| &lt;LBRACKET: "["&gt;
| &lt;RBRACKET: "]"&gt;
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;DEFAULT&gt; TOKEN : {
&lt;PLUS: "+"&gt;
| &lt;MINUS: "-"&gt;
| &lt;MULTIPLY: "*"&gt;
| &lt;DIVIDE: "/"&gt;
| &lt;MODULE: "%"&gt;
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;DEFAULT&gt; TOKEN : {
&lt;EQUAL: "="&gt;
| &lt;EQEQUAL: "=="&gt;
| &lt;EQLESS: "&lt;="&gt;
| &lt;EQGREATER: "&gt;="&gt;
| &lt;NOTEQUAL: "!="&gt;
| &lt;LESS: "&lt;"&gt;
| &lt;GREATER: "&gt;"&gt;
| &lt;LESSGREATER: "&lt;&gt;"&gt;
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;DEFAULT&gt; TOKEN : {
&lt;AND: "and"&gt;
| &lt;OR: "or"&gt;
| &lt;NOT: "not"&gt;
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;DEFAULT&gt; TOKEN : {
&lt;IF: "if"&gt;
| &lt;ELIF: "elif"&gt;
| &lt;ELSE: "else"&gt;
| &lt;FOR: "for"&gt;
| &lt;IN: "in"&gt;
| &lt;WHILE: "while"&gt;
| &lt;DEF: "def"&gt;
| &lt;PRINT: "print"&gt;
| &lt;BREAK: "break"&gt;
| &lt;CONTINUE: "continue"&gt;
| &lt;RETURN: "return"&gt;
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;DEFAULT&gt; TOKEN : {
&lt;STRING: "\"" (~["\n","\r"])* "\"" | "\'" (~["\n","\r"])* "\'"&gt;
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;DEFAULT&gt; TOKEN : {
&lt;FLOAT: ("-")? (["0"-"9"])+ "." (["0"-"9"])+&gt;
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;DEFAULT&gt; TOKEN : {
&lt;INTEGER: ("-")? ["0"-"9"] (["0"-"9"])*&gt;
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;DEFAULT&gt; TOKEN : {
&lt;IDENTIFIER: ["a"-"z","A"-"Z"] (["a"-"z","A"-"Z"] | ["0"-"9"] | ["_"])*&gt;
}

   </PRE>
  </TD>
 </TR>
 <!-- Token -->
 <TR>
  <TD>
   <PRE>
&lt;DEFAULT&gt; TOKEN : {
&lt;BOOLEAN: "True" | "False"&gt;
}

   </PRE>
  </TD>
 </TR>
</TABLE>
<H2 ALIGN=CENTER>NON-TERMINALS</H2>
<TABLE>
 <!-- Special token -->
 <TR>
  <TD>
<PRE>
// List 
</PRE>
  </TD>
 </TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod1">List</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod2">Primary</A> ( &lt;COMMA&gt; <A HREF="#prod2">Primary</A> )*</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod3">ListDisplay</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;LBRACKET&gt; ( <A HREF="#prod1">List</A> )? &lt;RBRACKET&gt;</TD>
</TR>
 <!-- Special token -->
 <TR>
  <TD>
<PRE>
// Literal
</PRE>
  </TD>
 </TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod4">Literal</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>( <A HREF="#prod5">LiteralString</A> | <A HREF="#prod6">LiteralInteger</A> | <A HREF="#prod7">LiteralFloat</A> )</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod8">Identifier</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;IDENTIFIER&gt;</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod7">LiteralFloat</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;FLOAT&gt;</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod6">LiteralInteger</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;INTEGER&gt;</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod5">LiteralString</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;STRING&gt;</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod9">Atom</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>( <A HREF="#prod8">Identifier</A> | <A HREF="#prod4">Literal</A> | <A HREF="#prod3">ListDisplay</A> )</TD>
</TR>
 <!-- Special token -->
 <TR>
  <TD>
<PRE>
// Call Function
</PRE>
  </TD>
 </TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod10">ArgumentList</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod11">Expr</A> ( &lt;COMMA&gt; <A HREF="#prod11">Expr</A> )*</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod12">CallFunction</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod8">Identifier</A> &lt;LBRACE&gt; ( <A HREF="#prod10">ArgumentList</A> )? &lt;RBRACE&gt;</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod13">CallList</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod8">Identifier</A> &lt;LBRACKET&gt; ( <A HREF="#prod6">LiteralInteger</A> | &lt;COLON&gt; ) &lt;RBRACKET&gt;</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod2">Primary</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>( <A HREF="#prod12">CallFunction</A> | <A HREF="#prod13">CallList</A> | <A HREF="#prod9">Atom</A> )</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod14">AssignmentStmt</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod9">Atom</A> &lt;EQUAL&gt; <A HREF="#prod11">Expr</A></TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod15">PrintStmt</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;PRINT&gt; <A HREF="#prod11">Expr</A></TD>
</TR>
 <!-- Special token -->
 <TR>
  <TD>
<PRE>
// Expression Statement
</PRE>
  </TD>
 </TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod16">TermOper</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod17">FactorOper</A> ( ( &lt;PLUS&gt; <A HREF="#prod17">FactorOper</A> | &lt;MINUS&gt; <A HREF="#prod17">FactorOper</A> ) )*</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod17">FactorOper</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod2">Primary</A> ( ( &lt;MULTIPLY&gt; <A HREF="#prod16">TermOper</A> | &lt;DIVIDE&gt; <A HREF="#prod16">TermOper</A> | &lt;MODULE&gt; <A HREF="#prod16">TermOper</A> ) )*</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod18">Comparison</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod16">TermOper</A> ( <A HREF="#prod19">CompOper</A> <A HREF="#prod16">TermOper</A> )*</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod19">CompOper</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>( &lt;EQEQUAL&gt; | &lt;LESS&gt; | &lt;GREATER&gt; | &lt;EQLESS&gt; | &lt;EQGREATER&gt; | &lt;NOTEQUAL&gt; | &lt;LESSGREATER&gt; )</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod20">NotExpr</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>( &lt;NOT&gt; <A HREF="#prod20">NotExpr</A> | <A HREF="#prod18">Comparison</A> )</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod21">AndExpr</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod20">NotExpr</A> ( &lt;AND&gt; <A HREF="#prod20">NotExpr</A> )*</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod22">OrExpr</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod21">AndExpr</A> ( &lt;OR&gt; <A HREF="#prod21">AndExpr</A> )*</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod23">CondExpr</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod22">OrExpr</A></TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod11">Expr</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod23">CondExpr</A></TD>
</TR>
 <!-- Special token -->
 <TR>
  <TD>
<PRE>
// Simple Statement
</PRE>
  </TD>
 </TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod24">SimpleStmt</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>( <A HREF="#prod15">PrintStmt</A> | <A HREF="#prod25">BreakStmt</A> | <A HREF="#prod26">ContinueStmt</A> | <A HREF="#prod27">ReturnStmt</A> | <A HREF="#prod14">AssignmentStmt</A> | <A HREF="#prod11">Expr</A> )</TD>
</TR>
 <!-- Special token -->
 <TR>
  <TD>
<PRE>
// Ciclos
</PRE>
  </TD>
 </TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod26">ContinueStmt</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;CONTINUE&gt;</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod25">BreakStmt</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;BREAK&gt;</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod27">ReturnStmt</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;RETURN&gt; <A HREF="#prod11">Expr</A></TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod28">ParameterList</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod8">Identifier</A> ( &lt;COMMA&gt; <A HREF="#prod8">Identifier</A> )*</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod29">Elif</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;ELIF&gt; <A HREF="#prod11">Expr</A> &lt;COLON&gt; <A HREF="#prod30">Suite</A></TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod31">Else</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;ELSE&gt; &lt;COLON&gt; <A HREF="#prod30">Suite</A></TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod32">If</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;IF&gt; <A HREF="#prod11">Expr</A> &lt;COLON&gt; <A HREF="#prod30">Suite</A></TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod33">IfStmt</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod32">If</A> ( <A HREF="#prod29">Elif</A> )* ( <A HREF="#prod31">Else</A> )?</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod34">For</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;FOR&gt; <A HREF="#prod8">Identifier</A> &lt;IN&gt; <A HREF="#prod13">CallList</A> &lt;COLON&gt; <A HREF="#prod30">Suite</A></TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod35">ForStmt</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod34">For</A> ( <A HREF="#prod31">Else</A> )?</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod36">While</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;WHILE&gt; <A HREF="#prod11">Expr</A> &lt;COLON&gt; <A HREF="#prod30">Suite</A></TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod37">WhileStmt</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod36">While</A> ( <A HREF="#prod31">Else</A> )?</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod38">DefFunction</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;DEF&gt; <A HREF="#prod8">Identifier</A> &lt;LBRACE&gt; ( <A HREF="#prod28">ParameterList</A> )? &lt;RBRACE&gt; &lt;COLON&gt; <A HREF="#prod30">Suite</A></TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod39">CompoundStmt</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>( <A HREF="#prod33">IfStmt</A> | <A HREF="#prod35">ForStmt</A> | <A HREF="#prod37">WhileStmt</A> )</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod40">Stmt</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>( <A HREF="#prod38">DefFunction</A> | <A HREF="#prod24">SimpleStmt</A> | <A HREF="#prod39">CompoundStmt</A> )</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod30">Suite</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>&lt;INDENT&gt; ( <A HREF="#prod40">Stmt</A> )+ &lt;DEDENT&gt;</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod41">Start</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
<TD ALIGN=LEFT VALIGN=BASELINE>( <A HREF="#prod40">Stmt</A> )+ ( &lt;EOF&gt; )?</TD>
</TR>
</TABLE>
</BODY>
</HTML>
